<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "xa_message".
 *
 * @property integer $id
 * @property string $xa_name
 * @property string $xa_mobil
 * @property string $xa_email
 * @property string $xa_content
 * @property string $xa_reply
 * @property string $xa_parent_id
 * @property string $xa_create_time
 * @property string $xa_update_time
 * @property string $xa_state
 * @property string $xa_remark
 */
class Message extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'xa_message';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['xa_content', 'xa_reply'], 'string'],
            ['xa_mobil','match','pattern'=>'/^1[0-9]{10}$/','message'=>'{attribute}必须为1开头的11位纯数字'],
            ['xa_email','email','message'=>'请输入正确的邮箱格式'],
            [['xa_name', 'xa_mobil', 'xa_email', 'xa_state', 'xa_remark'], 'string', 'max' => 255],
            [['xa_parent_id'], 'string', 'max' => 50],
            [['xa_create_time', 'xa_update_time'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'xa_name' => '姓名',
            'xa_mobil' => '手机',
            'xa_email' => '邮箱',
            'xa_content' => '内容',
            'xa_reply' => '回复',
            'xa_parent_id' => '父级回复',
            'xa_create_time' => '创建时间',
            'xa_update_time' => '更新时间',
            'xa_state' => '状态',
            'xa_remark' => '备注',
        ];
    }

}
